<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8" autoFlush="true"%>
<%@ page import="java.util.*"%>
<%@ include file="/common/commonforback.jsp"%>
<%
	String formid=request.getParameter("formid");
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Department Content</title>
<link rel="stylesheet" href="<o:Url value="/resource/css/back/main.css" />" style="text/css" media="all" />
<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script type='text/javascript' src='<o:Url value="/dwr/interface/CommUtil.js" />'></script>
<script type='text/javascript' src='<o:Url value="/dwr/engine.js" />'></script>
<script type='text/javascript' src='<o:Url value="/dwr/util.js" />'></script>
<!-- <script type='text/javascript' src='<o:Url value="/script/back/formeditor/editor_field.js" />'></script>-->
<script language="JavaScript">
	var dialog	= window.parent ;
	var oEditor = dialog.InnerDialogLoaded() ;
	// Gets the document DOM
	var oDOM = oEditor.FCK.EditorDocument ;
	var oActiveEl = dialog.Selection.GetSelectedElement() ;

	var fieldid="";
	DWREngine.setAsync(true);
	if (oActiveEl==null || oActiveEl==undefined){
		CommUtil.getUUID(function(id) {
  			fieldid = id;
  		});
  	}else{
  		fieldid=oActiveEl.id;
  	}
	
	//初始值
	window.onload = function(){
		//document.getElementsByName("formlist")[0].value=document.getElementById("formid").value;
		oEditor.FCKLanguageManager.TranslatePage(document) ;
		if ( oActiveEl && (oActiveEl.tagName == 'INPUT')){
			if(oActiveEl.name!=null){
				temp.name.value	= oActiveEl.name;
				temp.fieldType.value=oActiveEl.fieldType;
				temp.discription.value	= oActiveEl.discription;
			}
		}
		else{
			oActiveEl = null ;
		}
		dialog.SetOkButton( true ) ;
		dialog.SetAutoSize( true ) ;
		SelectField( 'name' ) ;
	}
	
	function Ok(){
		oEditor.FCKUndo.SaveUndoStep() ;
		var className="edu.isquen.core.form.model.element.TextField";
		var id=fieldid;
		oActiveEl = CreateNamedElement( 
							oEditor, 
							oActiveEl, 
							'INPUT', 
							{
								id : id,
								name : temp.name.value,
								classname : className,
								fieldType : temp.fieldType.value,
								discription : temp.discription.value
							} 
					);	
		return true ;
	}
</script>
</head>
<body>
<form name="temp">
<table border="1" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td>名称：</td>
		<td><input type="text" name="name" size="20"></td>
	</tr>
	<tr>
		<td>文本类型：</td>
		<td><input type="text" name="fieldType" size="20" value="VALUE_TYPE_VARCHAR"></td>
	</tr>
	<tr>
		<td>描述：</td>
		<td><textarea name="discription" style="width: 100%;"
			rows="4"></textarea></td>
	</tr>
</table>
</form>
</body>
</html>

